package com.zygh.policeasset.mapper;

import com.zygh.policeasset.pojo.Department;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
/* loaded from: police-asset-2.0-0.0.1-SNAPSHOT.jar:BOOT-INF/classes/com/zygh/policeasset/mapper/DepartmentMapper.class */
public interface DepartmentMapper {
    @Insert({"insert into department(department_num,department_name) values(#{departmentNum},#{departmentName})"})
    Integer add(Department department);

    @Delete({"delete from department where id = #{id}"})
    Integer delete(Integer num);

    @Update({"update  department set department_num = #{departmentNum},department_name = #{departmentName} where id = #{id}"})
    Integer update(Department department);

    @Select({"<script> select * from department <where> " +
            "<if test='id != null and id.length &gt; 0'>id = #{id} </if>" +
            "<if test='departmentNum != null and departmentNum.length &gt; 0'>department_num = #{departmentNum} </if>" +
            "<if test='departmentName != null and departmentName.length &gt; 0'>department_name = #{departmentName} </if>" +
            "</where> </script>"})
    @Results({@Result(property = "departmentNum", column = "department_num"), @Result(property = "departmentName", column = "department_name")})
    List<Department> findDepartment(Integer id, String departmentNum, String departmentName);

    @Select({"<script> select department_num from department <where> <if test='departmentName != null and departmentName.length &gt; 0'>department_name = #{departmentName} </if></where> </script>"})
    String findByDepartment(String str);
}